﻿using System;
using Common.DataStructures;
using NUnit.Framework;

namespace CommonUnitTests.DataStructureTests
{
    [TestFixture]
    public class TrieTests
    {
        public class TheFindMethod
        {
            private readonly Trie<String> _trie;
            public TheFindMethod()
            {
                _trie = new Trie<string>();
                _trie.AddValue("test", "test"); 
            }

            [Test]
            public void SupportsPartialMatch()
            {
                Assert.That(_trie.Search("t"), Is.EqualTo(SearchResult.PartialMatch));
            }

            [Test]
            public void SupportsFullMatch()
            {
                Assert.That(_trie.Search("test"), Is.EqualTo(SearchResult.FullMatch));
            }

            [Test]
            public void SupportsNoMatch()
            {
                Assert.That(_trie.Search("est"), Is.EqualTo(SearchResult.NoMatch));
            }
        }
    }
}
